-- @owner: xue-xinyi610
-- @date: 2025/2/20
-- @testpoint: I8XDZ2 原有功能在新需求合入后不受影响，启用单个触发器。，执行成功。。

-- 步骤pre 1
drop table if exists test_table;
-- 步骤pre 2
CREATE TABLE test_table (id1 INT, id2 INT, id3 INT);
-- 步骤pre 3
drop function if exists test_function;
-- 步骤pre 4
CREATE FUNCTION test_function() RETURNS TRIGGER AS
$$
DECLARE
BEGIN
update test_table set id2 = 5 where id1 = 1;
return NEW;
END
$$ LANGUAGE PLPGSQL;/

-- 步骤pre 5
drop trigger if exists test_trigger on test_table;
-- 步骤pre 6
CREATE TRIGGER test_trigger
BEFORE INSERT ON test_table
EXECUTE PROCEDURE test_function();/
-- 步骤pre 7
alter table test_table disable trigger test_trigger;
-- 步骤test 1
alter table test_table enable trigger test_trigger;
-- 步骤post 1
drop trigger test_trigger on test_table;
-- 步骤post 2
drop function test_function;
-- 步骤post 3
drop table test_table;
